<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
        <meta name="format-detection" content="telephone=no,email=no,adress=no" />
        <META HTTP-EQUIV="luxiaoqing" CONTENT="no-cache">

        <jsp:include page="../lbi/merCommon.jsp"></jsp:include>
        <script type="text/javascript" src="<c:url value="/js/dcalendar.picker.js"/>"></script>
        
        <title>69圈城-商家</title>
    </head>

    <body>
        <!--头部-->
        <div class="business_top">
            <jsp:include page="../lbi/merHead.jsp"></jsp:include>

            <div class="clear"></div>
        </div>
        <!--头部end-->

        <div class="clear4"></div>

        <!--中间-->
        <div class="individual_form-center">
            <!--左边导航部分-->
            <jsp:include page="../lbi/merLeft.jsp"></jsp:include>
            <!--左边导航部分end-->

            <!--右边详情部分-->
            <div class="individual_form-center-right">
                <!--所在位置-->
                <div class="individual_form-center-right-position">
                    <span class="span01">商家优惠</span>

                    <span class="span01">></span>

                    <span class="span01">发布优惠券</span>
                </div>
                <!--所在位置end-->

                <div class="clear"></div>

                <div class="individual_form-center-right-details">
                    <div class="individual-form-job_release">
                    
                        <form method='post' action="<c:url value="/merchant/toSaveCoupon.do"/>">
                            <input type="hidden" name="shopId" value="${shopId }">
                        
                            <div class="individual-form-job_release-form">
                                <div class="clear4"></div>
                                <div class="individual-form-job_release-form-left">
                                    <!--标题-->
                                    <div class="individual-form-job_release-form-demo01">
                                        <div class="individual-form-job_release-form-demo01-span">
                                            <span class="span01">*</span>

                                            <span class="span02">标题</span>
                                        </div>

                                        <div class="individual-form-job_release-form-demo01-input">
                                            <input type="text" value="" name='title' required />
                                        </div>

                                        <div class="clear"></div>
                                    </div>
                                    <!--标题end-->
                                    
                                    <div class="clear3"></div>
                                    <!--类型-->
									<div class="individual-form-job_release-form-demo01">
										<div class="individual-form-job_release-form-demo01-span">
											<span class="span01">*</span>

											<span class="span02">类型</span>
										</div>
										<input type="radio" id="radio1" class="xuanze" name='type' value="1" checked="checked"/>&nbsp;&nbsp;立减&nbsp;&nbsp;&nbsp;&nbsp;
										<input type="radio" id="radio2" class="xuanze" name='type' value="2" />&nbsp;&nbsp;满减&nbsp;&nbsp;&nbsp;&nbsp;
										<input type="radio" id="radio3" class="xuanze" name='type' value="3" />&nbsp;&nbsp;体验券&nbsp;&nbsp;&nbsp;&nbsp;
										
										<div class="clear"></div>
									</div>
									<!--类型end-->
                                    <div class="clear3"></div>
                                    
                                    <div class="individual-form-job_release-form-demo01 danzhang">
										<div class="individual-form-job_release-form-demo01-span ">
											<span class="span01">*</span>

											<span class="span02">单张金额(¥)</span>
										</div>

										<div class="individual-form-job_release-form-demo01-input">
											<input type="text" value="0" name='money' onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" />
										</div>

										<div class="clear"></div>
									</div>
									<div class="individual-form-job_release-form-demo01 tiyan" style="display: none;">
										<div class="individual-form-job_release-form-demo01-span">
											<span class="span01">*</span>

											<span class="span02">数量</span>
										</div>

										<div class="individual-form-job_release-form-demo01-input">
											<input type="text" value="0" name="tiyan_num" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" />
										</div>

										<div class="clear"></div>
									</div>
									<!--单张金额end-->
									<div class="clear3"></div>
									
									<!--限定金额-->
									<div class="individual-form-job_release-form-demo01 xianding" id="num" style="display: none; margin-bottom: 30px;">
										<div class="individual-form-job_release-form-demo01-span">
											<span class="span01">*</span>

											<span class="span02">限定金额(¥)</span>
										</div>
										
										<div class="individual-form-job_release-form-demo01-input">
											<input type="text" value="0" name='money2' onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)"  />
										</div>
									</div>
									<!--限定金额end-->
									<div class="clear"></div>
                                    <!--有效时间-->
									<div class="individual-form-job_release-form-demo01 youxiao">
										<div class="individual-form-job_release-form-demo01-span">
											<span class="span01">*</span>

											<span class="span02">优惠券有效期</span>
										</div>
										
										<input class='date-input' value="" name="couponStartDate" id='mydatepicker_1' type="text"  />
                                        <span class='sep-line'>—</span>
                                        <input class='date-input' value="" name="couponEndDate" id='mydatepicker_2' type="text"  />

										<div class="clear"></div>
									</div>
									<!--有效时间end-->
									<div class="clear3"></div>
                                    
                                </div>

                                <div class="individual-form-job_release-form-right">
                                    <!--类型-->
                                    <div class="individual-form-job_release-form-demo01">
                                        <div class="individual-form-job_release-form-demo02-span">
                                            <span class="span01">*</span>

                                            <span class="span02">活动时间</span>
                                        </div>

                                        <input class='date-input' name="startDate" id='mydatepicker' type="text" required />
                                        <span class='sep-line'>—</span>
                                        <input class='date-input' name="endDate" id='mydatepicker2' type="text" required />
                                     </div>
                                     
                                      <div class="clear3"></div>

                                    <!--数量-->
                                    <div class="individual-form-job_release-form-demo02 shuliang" style="margin-top: 65px;">
                                        <div class="individual-form-job_release-form-demo02-span">
                                            <span class="span01">*</span>

                                            <span class="span02">数量</span>
                                        </div>

                                        <div class="individual-form-job_release-form-demo02-input">
                                            <input type="text" value="0" name='num' onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)"  />
                                        </div>

                                        <div class="clear"></div>
                                    </div>
                                    <!--数量end-->

                                    <div class="clear3"></div>
                                </div>

                                <div class="clear"></div>

                                <div class="individual-form-job_release-form-bottom">
                                    <!--使用规则-->
                                    <div class="individual-form-job_release-form-demo04">
                                        <div class="individual-form-job_release-form-demo04-span">
                                            <span class="span01">*</span>

                                            <span class="span02">使用规则</span>
                                        </div>

                                        <div class="individual-form-job_release-form-demo04-textarea">
                                            <textarea name='content' required></textarea>
                                        </div>

                                        <div class="clear"></div>
                                    </div>
                                    <!--使用规则end-->
                                </div>

                                <div class="clear5"></div>
                                <div class="xinxi">信息填写不完整</div>
                                 <div class="clear1"></div>
	
                                <div class="individual-form-job_release-form-sub">
                                    <div class="individual-form-job_release-form-sub-confirm">
                                        <input id="submit" type="submit" value="发布"/>
                                    </div>

                                    <!-- <div class="individual-form-job_release-form-sub-cancel">
                                                <input type="button" value="取消"/>
                                            </div> -->

                                    <div class="clear"></div>
                                </div>

                                <div class="clear"></div>
                            </div>
                        </form>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            <!--右边详情部分end-->

            <div class="clear2"></div>
        </div>
        <!--中间end-->

        <div class="clear2"></div>

        <!--底部-->
        <div class="business_foot">
            <jsp:include page="../lbi/merFooter.jsp"></jsp:include>
        </div>
        <!--底部end-->

        <div class="clear8"></div>
        <script>
        $("#yhj").addClass("individual_form-center-left-nav-demo-02_dj");
        
        
        $(function(){
			$(".xuanze").click(function(){
				if($(this).attr("value")=="2"){
					$(".danzhang").show();
					$(".youxiao").show();
					$(".xianding").show();
					$(".tiyan").hide();
					$(".shuliang").show();
					$("#num").show();
				}
				else if($(this).attr("value")=="3"){
					$(".danzhang").hide();
					$(".tiyan").show();
					$(".shuliang").hide();
					$(".xianding").hide();
				}
				else{
					$(".danzhang").show();
					$(".tiyan").hide();
					$(".shuliang").show();
					$(".youxiao").show();
					$(".xianding").hide();
				}
			})
		})
		
		$(function() {
			$('.individual-form-job_release-form-demo01 input').on('click', function() {
				$(this).attr('checked', 'true').siblings().removeAttr('checked');
			})

			$("#submit").click(function() {
				var money = $('input[name="money"]').val();
				var money2 = $('input[name="money2"]').val();
				var num = $('input[name="num"]').val();
				var couponStartDate = $('input[name="couponStartDate"]').val();
				var couponEndDate = $('input[name="couponEndDate"]').val();
				var tiyan_num = $('input[name="tiyan_num"]').val();
				
				if($("#radio1").attr("checked") == 'checked') {
					if(money != "" && couponStartDate != "" && couponEndDate != "" && num != "") {
						return true;
					} else {
						$(".xinxi").show();
						return false;
					}
				} else if($("#radio2").attr("checked") == 'checked') {
					if(money != "" && couponStartDate != "" && couponEndDate != "" && money2 != "" && num != "") {
						return true;
					} else {
						$(".xinxi").show();
						return false;
					}
				} else {
					if(tiyan_num != "") {
						return true;
					} else {
						$(".xinxi").show();
						return false;
					}
				} 
				
			})
		})
		
		$('#mydatepicker').dcalendarpicker();
        $('#mydatepicker2').dcalendarpicker({
            format: 'yyyy-mm-dd'
        });
        
        $('#mydatepicker_1').dcalendarpicker();
        $('#mydatepicker_2').dcalendarpicker({
            format: 'yyyy-mm-dd'
        });
        $('#mycalendar').dcalendar();
		
        </script>
    </body>

</html>